package com.tgy.demo2;

/***
 * @ClassName: UserServiceProxy
 * @Description: 代理角色
 * @Auther: 送一一块二向箔
 * @Date: 15:06 2021/12/17
 * @version : V1.0
 */
public class UserServiceProxy implements UserService{
    private UserService userService;

    public UserServiceProxy setUserService(UserService userService) {
        this.userService = userService;
        return this;
    }


    public  void log(String msg){
        System.out.println("使用了"+msg+"方法");
    }

    @Override
    public void add() {
        log("add");
        userService.add();
    }

    @Override
    public void delete() {
        log("delete");
        userService.delete();
    }

    @Override
    public void update() {
        log("update");
        userService.update();
    }

    @Override
    public void select() {
        log("select");
        userService.select();
    }
}
